/* eslint-disable no-unused-vars */
/**
 * @description: table表格组件
 * @author: Daniel
 * @update: 2022/1/11
 */
import * as React from 'react'
import { DataGrid } from '@mui/x-data-grid'
import { Box, Grid } from '@material-ui/core'
import Pagination from '@material-ui/lab/Pagination'

export default function DataGridDemo({
  datas = [],
  columns = [],
  count = 0,
  pageNum = 1,
  onChange = () => {},
  onSelectionModelChange = () => {},
}) {
  return (
    <Box style={{ height: 400, width: '100%' }}>
      <DataGrid
        rows={datas}
        columns={columns}
        hideFooterPagination
        hideFooter
        checkboxSelection
        disableSelectionOnClick
        onSelectionModelChange={onSelectionModelChange}
      />
      <Grid container style={{ height: '80px' }} direction='row' alignItems='center' justifyContent='flex-end'>
        {count > 1 ? (
          <Pagination count={count} color='primary' page={pageNum} shape='rounded' onChange={onChange} />
        ) : null}
      </Grid>
    </Box>
  )
}
